char c[102],d[101];f[500];l;
u(int*a,int*b){return*b-*a;}
main(i,w)
{
	for(gets(c);gets(c);)
	{
		for(w=i=0,strcpy(c+strlen(c),"e");c[i];i++)
		{
			if(isalpha(c[i])&&w)
				d[w]=0,sscanf(d,"%d",f+l++),w=0;
			if(isdigit(c[i]))d[w++]=c[i];
		}
	}
	qsort(f,l,4,u);
	for(;l;printf("%d\n",f[--l]));
}
